

<%@ page import="les.Indicacao" %>
<html>
    <head>
    	<resource:autoComplete skin="default" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'indicacao.label', default: 'Indicacao')}" />
        <title><g:message code="default.create.label" args="[entityName]" /></title>
    </head>
    <body>
        
        <div class="body">
            <h1>Indicação de Integrantes</h1><br><br>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${indicacaoInstance}">
            <div class="errors">
                <g:renderErrors bean="${indicacaoInstance}" as="list" />
            </div>
            </g:hasErrors>
            
            <g:form action="save" method="post">
            
			    <table border="0" style="width: 600px;">
   				<tr>
   		
   					<td style="text-align: left; width: 100px;">Integrante: </td>
   	   				<td align="left"><richui:autoComplete name="indicarIntegrante" id="indicarIntegrante" action="${createLinkTo('dir': 'indicacao/pegarIntegrantesParaAdicionar/')}" maxResultsDisplayed="5" forceSelection="true" style="width: 350px;" /></td>
   	   	
   				</tr>
   	
   				<tr>
   	
   					<td style="text-align: left; width: 100px;">Equipe:</td>
   					<td align="left"><richui:autoComplete name="escolherEquipe" id="escolherEquipe" action="${createLinkTo('dir': 'indicacao/pegarEquipesParaAdicionar/')}" maxResultsDisplayed="5" forceSelection="true" style="width: 350px;" /></td>
   		
   				</tr>
   	
   				<tr>
   	
   					<td colspan="2"><input type="submit" value="Indicar" id="indicar"></td>
   	
   				</tr>
   				</table>
            </g:form>
            
            <br><br>
   	
   			<table border="0" style="width: 600px;">
   			<tr><th>Integrante</th><th>Equipe</th><th>Excluir</th></tr>
			
			<g:set var="index" value="${0 }" />
			<g:each in="${session.indicacoes}" status="i" var="indicacao">
			<g:set var="ehImpar" value="${true}" />
   			<g:if test="${index % 2 == 0}"><g:set var="ehImpar" value="${false}" /></g:if>
   	
   			<tr
   			<g:if test="${ehImpar}"> bgcolor="#eeeeee"</g:if>
   			>
   			
   			<td>${indicacao.integrante.nome }</td><td>${indicacao.indicacao.nome }</td>
   			<td><g:form action="delete" method="post">
   			<g:hiddenField name="id" value="${indicacao.id}" />
   			<input type="submit" value="Excluir" id="delete" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');">
   			</g:form></td>
   	
   			</tr>
   	
   			<g:set var="index" value="${index + 1}" />
   	
   			</g:each> 	
		
		   	</table>
        </div>
    </body>
</html>
